package com.edmond.jyframe.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.util.Log;

import com.edmond.jyframe.R;
import com.edmond.jyframe.activity.base.BaseActivity;
import com.edmond.jyframe.fragments.GoodsCommentFragment;
import com.edmond.jyframe.fragments.GoodsWebFragment;
import com.edmond.jyframe.presenter.base.NavPresenter;
import com.edmond.jyview.widget.JYFragmentPagerAdapter;
import com.edmond.jyview.widget.JYNestedScrollWebView;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.util.ArrayList;

/**
 * Created by edmond on 17-4-28.
 */

public class GoodsInfoActivity extends BaseActivity<NavPresenter> {

    private TabLayout tabLayout;
    private ViewPager viewPager;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_goods);

        tabLayout = (TabLayout) findViewById(R.id.tab);
        viewPager = (ViewPager) findViewById(R.id.viewpager_goods);

        ArrayList<Fragment> fragments = new ArrayList<>();
        fragments.add(new GoodsWebFragment());
        fragments.add(new GoodsCommentFragment());

        viewPager.setAdapter(new JYFragmentPagerAdapter(getSupportFragmentManager(),fragments));

        TabLayout.Tab tab1 = tabLayout.newTab();
        TabLayout.Tab tab2 = tabLayout.newTab();

        tab1.setText("介绍");
        tab2.setText("评价");

        tabLayout.addTab(tab1);
        tabLayout.addTab(tab2);

        viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
        tabLayout.setOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager));
    }

    @Override
    public Class[] initModelName() {
        return new Class[0];
    }
}
